package com.qibao.toolkit.exception.strategy.impl;

import com.qibao.toolkit.exception.strategy.AbstractExceptionHandleStrategy;
import com.qibao.toolkit.exception.strategy.ExceptionHandleType;
import com.qibao.toolkit.web.ResponseModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author wangcheng
 * @version $Id: IllegalArgumentExceptionHandleStrategy.java, v0.1 2019/3/6 14:21 wangcheng Exp $$
 */
@ExceptionHandleType(IllegalArgumentException.class)
public class IllegalArgumentExceptionHandleStrategy extends AbstractExceptionHandleStrategy {

    private final static Logger logger = LoggerFactory.getLogger(IllegalArgumentExceptionHandleStrategy.class);

    @Override
    public ResponseModel doHandle(Throwable throwable) {

        logger.error("error.param.bad",throwable);

        return ResponseModel.ERROR(throwable.getMessage());
    }
}
